package br.com.vilababy.sigvb.modelo;

import java.io.Serializable;

import javax.persistence.Embeddable;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;

@Embeddable
public class FuncaoAdmissaoPK implements Serializable {

	/**
	 * @author Diego Patrick da Silva Santos
	 */
	private static final long serialVersionUID = 1L;

	@ManyToOne
	@JoinColumn(nullable=false)
	private Funcao funcao;
	@ManyToOne
	@JoinColumn(nullable=false)
	private Admissao admissao;
	
	public FuncaoAdmissaoPK() {
	}

	public final Funcao getFuncao() {
		return funcao;
	}
	public final void setFuncao(Funcao funcao) {
		this.funcao = funcao;
	}
	public final Admissao getAdmissao() {
		return admissao;
	}
	public final void setAdmissao(Admissao admissao) {
		this.admissao = admissao;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result
				+ ((admissao == null) ? 0 : admissao.hashCode());
		result = prime * result + ((funcao == null) ? 0 : funcao.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		FuncaoAdmissaoPK other = (FuncaoAdmissaoPK) obj;
		if (admissao == null) {
			if (other.admissao != null)
				return false;
		} else if (!admissao.equals(other.admissao))
			return false;
		if (funcao == null) {
			if (other.funcao != null)
				return false;
		} else if (!funcao.equals(other.funcao))
			return false;
		return true;
	}
	
	
}
